package com.ypf.rpc.loadBalancer;

import com.ypf.rpc.manager.register.pojo.RegisterInfo;

import java.util.List;
import java.util.Random;

/**
 * 负载均衡随机算法
 */
public class RandomRule implements LoadBalancer{

    private final Random random = new Random();


    @Override
    public RegisterInfo getRegisterInfo(List<RegisterInfo> registerInfoList) {
        return registerInfoList.get(random.nextInt(registerInfoList.size()));
    }
}
